import requests as rqs
from bs4 import BeautifulSoup as bs


class getcon(object):
    title = '_'
    content = '_'

    def getcontent(self, murl, charsetcode):
        print('################## all content has get ####################')
        head = {
            'Accept': 'image/webp,image/*,*/*;q=0.8',
            'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
            'accept-encoding': 'gzip, deflate, sdch, br',
            'accept-language': 'zh-CN,zh;q=0.8',
            'cache-control': 'max-age=0',
            'if-modified-since': 'Mon, 04 Dec 2017 14:00:16 GMT',
            'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
        }
        r = rqs.session().get(url=murl, headers=head)
        r.encoding = charsetcode
        b = bs(r.text, 'lxml')
        return b
